import { Cartesian3, Viewer, Math } from "cesium";
import { viewerSatelliteMixin, viewerEffectMixin } from "./ViewerMixins";
const ViewerConfig: Viewer.ConstructorOptions = {
  // animation: false,
};

export const useCesiumViewer = (id: string) => {
  const viewer = new Viewer(id, ViewerConfig);
  viewer.creditDisplay.container.style.visibility = "hidden";
  viewer.camera.setView({
    destination: Cartesian3.fromDegrees(120.0, 30.0, 28000000), // 杭州坐标
    orientation: {
      heading: Math.toRadians(0), // 朝向东北
      pitch: Math.toRadians(-90), // 斜视角
      roll: 0,
    },
  });

  viewer.extend(viewerSatelliteMixin);
  viewer.extend(viewerEffectMixin);
  return viewer;
};
